gtk: Change gtk_widget_get_visual()
authorBenjamin Otte <otte@redhat.com>
Sat, 28 Aug 2010 16:52:27 +0000 (18:52 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:11:31 +0000 (15:11 +0200)
commit913f3fcc9f66de4bcb35d8bbc04cadd50ae39634
tree56d99fe0304237b74124f27ba13e94bb2dcad2fe
parent600f52321b53f21e1051ae0923c4232619cecc89
gtk: Change gtk_widget_get_visual()

We now return the visual of the topmost widget in widget's stack that
has a window. If no such widget exists, but a GtkWindow is a parent, we
return its visual (note: GtkWindow Will gain support for setting visuals
soon). If a window doesn't exist, we return the system visual of the
default screen.

This change has multiple reasons:
- Colormaps are gone
  Now visuals are the most important resource for creating GDK windows.
- Allow widgets to change visuals for themselves and their children
  By walking the hierarchy, we ensure that child windows have the same
  visual as their parents by default. But widgets can still select a
  different visual in their realize handler when creating the GDK
  window.
- Have a replacement for gtk_widget_set_colormap()
  That function is going to die with colormaps, so a replacement was
  needed. That replacement is going to be gdk_window_set_visual().
- Make a future transition to no-window GTK easy
  Should we ever attempt a change to make all GTK widgets no-window, a
  gtk_widget_set_visual() would be silly, as only widgets with windows
  can have their own visuals. So only toplevels will gain the ability to
  change it.
gtk/gtkwidget.c